package com.bwie.controller;

import com.bwie.common.pojo.dto.UserDto;
import com.bwie.common.pojo.po.UserPo;
import com.bwie.common.result.Result;
import com.bwie.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @PostMapping("/login")
    private Result login(@RequestBody UserDto userDto){
        return userService.login(userDto);
    }

    @GetMapping("/byUserIdGetRoleIdList/{userId}")
    private Result getRoleId(@PathVariable("userId") Integer userId){
        return userService.getRoleId(userId);
    }
    @PostMapping("/register")
    void register(@RequestBody UserDto userDto){
        userService.register(userDto);
    }

    @PostMapping("/newLogin")
    private UserPo newLogin(@RequestBody UserDto userDto){
        return userService.newLogin(userDto);
    }
}
